define(
	[	 	
	appBasePath + '/scripts/module.js',
	appBasePath + '/scripts/common/http.js',
	],
	function(substanceModule){
		substanceModule.factory('Substance.GoodsService', [
		    '$q',
			'Demo.HttpService',			
		    function($q, httpService) {
	       	    return {
	       	    	create : function(data) {
						return httpService.post(appBasePath + '/goods/create', data);
					},
					upload: function(id, files, success) {
						return httpService.send(appBasePath + '/goods/upload?id=' + id, files, success);
					},
					update: function(id, data) {
						return httpService.post(appBasePath + '/goods/update/' + id, data);
					},
					// 删除图片
					deleteImage: function(id) {
						return httpService.post(appBasePath + '/goods/deleteImage/' + id, {});
					},
					// 入库
					storein: function(id, count) {
						return httpService.post(appBasePath + '/goods/storein/' + id + "/" + count, {});
					},
					showlist: function(page, data) {
						return httpService.post(appBasePath + '/goods/showlist/' + page, data);
					},
	       	    	save : function(data) {
						return httpService.post(appBasePath + '/goods/save', data);
					},
					remove: function(id) {
						return httpService.post(appBasePath + '/goods/remove', {id:id});
					},
					list : function(query, page) {
						return httpService.post(appBasePath + '/goods/list', {query: query, currentPage: page});
					},					
					get : function(id){
    					return httpService.post(appBasePath + '/goods/get/' + id, {});
    				},
    				updateGoodsStatus:  function(id, status){
    					return httpService.post(appBasePath + '/goods/update/status/' + id + "/" + status, {});
    				},
				};
			}
		]);
	}
);